package cn.hp.service.impl;

import cn.hp.entity.User;
import cn.hp.mapper.UserMapper;
import cn.hp.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public User doLogin(User user) {
        List<User> list = userMapper.selectUserByEmailAndPassword(user);
        return list.size() > 0 ? list.get(0) : null;
    }

    @Override
    public User selectUserById(Integer id) {
        return userMapper.selectUserById(id);
    }

    @Override
    public User login(String email) {
        return login(email);
    }


}
